// =================================================================
// File: ls.cpp
// Desc: Contains function for listing the contents of the current directory
// =================================================================

// =================================================================
// INCLUDES
// =================================================================

#include <iostream>
#include <string>
#include <map>
#include "FSManager.h"
#include "Directory.h"
#include "commands.h"

using namespace std;

// =================================================================
// FUNCTIONS
// =================================================================

// =================================================================
// Name: ls
// Desc: Prints the contents of the current directory
// Args: FSManager* fsm - pointer to active FSManager object
// =================================================================
void ls(FSManager *fsm){

    Directory *dir = fsm->GetCurrentDirectory();
    if (dir == NULL) {
      cerr << "Current Directory is NULL\n";
      return;
    }

    map<string,int> entries = dir->GetEntries();
    map<string,int>::iterator it;

    for(it = entries.begin(); it != entries.end(); it++)
    {
        cout << it->first << endl;
        // << " " << it->second << endl;
    
    }
    
    
}
